package com.liit.task;

import javax.inject.Inject;

import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.liit.mapper.ServerInfoMapper;

/**
 * Spring调度，指定时间执行 利用了spring中使用注解的方式来进行任务调度。
 * 
 * @author liit 2015-05-19
 * @Email: mmm333zzz520@163.com
 * @version 3.0v
 */
@Component
@Lazy(false)
public class SpringTaskController {
	@Inject
	private ServerInfoMapper serverInfoMapper;

	public static void main(String[] args) {
		SpringTaskController action = new SpringTaskController();
		try {
			action.task();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * 与用户设置的使用率比较 spirng 调度
	 * 
	 * @throws Exception
	 */
	@Scheduled(cron = "0 0 5  * * ? ")
	public void task() throws Exception {
		System.out.println(getClass() + ":任务执行");
	}
}